import config from "@/config/index";
let routes = [
  {
    path: "/",
    name: "home",
    component: () => import("@/views/home/index.vue"),
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/manager/login/index.vue"),
  },
  {
    path: "/manager",
    name: "manager",
    component: () => import("@/views/manager/index.vue"),
  },
];

const selectRouter = () => {
  switch (config.active) {
    case "dev":
      routes = [
        {
          path: "/home",
          name: "home",
          component: () => import("@/views/home/index.vue"),
          redirect: { path: "/home/homeBook" },
          children: [
            {
              path: "homeIndex",
              component: () => import("../views/home/index/index.vue"),
            },
            {
              path: "homeBook",
              component: () => import("../views/home/book/index.vue"),
            },
            {
              path: "homeBookDetail",
              component: () => import("../views/home/book/detail.vue"),
            },
          ],
        },
        {
          path: "/managerLogin",
          name: "managerLogin",
          component: () => import("@/views/manager/login/index.vue"),
        },
        {
          path: "/",
          name: "manager",
          component: () => import("@/views/manager/index.vue"),
          redirect: { path: "/tab" },
          children: [
            {
              path: "/managerHome",
              name: "managerHome",
              component: () => import("../views/manager/home/index.vue"),
            },
            {
              path: "/tab",
              name: "tab",
              component: () => import("../components/manager/dx-tab/index.vue"),
            },
          ],
        },
      ];
  }
};
selectRouter();

export default routes;
